package com.neu.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.neu.dao.ShoppingFeedbackMapper;
import com.neu.util.response.BaseResponse;
import com.neu.vo.EmptyVo;
import com.neu.vo.ShoppingFeedback;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class ShoppingFeedbackService {
    @Autowired(required = false)
    private ShoppingFeedbackMapper shoppingFeedbackMapper;
    /***
      * 意见反馈信息
      * description:
      * Param:
      * return:
      * Author: 张智康
      * Date:
      */
//    public ResponseEntity<BaseResponse<EmptyVo>> querySelective(ShoppingFeedback shoppingFeedback) {
//        PageHelper.startPage(shoppingFeedback.getPageNum(), shoppingFeedback.getPageSize());
//        List<ShoppingFeedback> list=shoppingFeedbackMapper.selectByExample(shoppingFeedback);
//        PageInfo<ShoppingFeedback> pageInfo =new PageInfo<>(list);
//        return BaseResponse.generateOKResponseEntity(pageInfo);
//    }

    public List<ShoppingFeedback> querySelective(Integer userId, String username, Integer page, Integer limit, String sort, String order) {
        //当前显示的是第几页
        int pageIndex = Integer.parseInt(String.valueOf(page));
        //每页显示多少条数据
        int pageSizeInt = Integer.parseInt(String.valueOf(limit));
        PageHelper.startPage(pageIndex,pageSizeInt);
        List<ShoppingFeedback> shoppingFeedbacks=shoppingFeedbackMapper.selectByExample(userId,username,page,limit,sort,order);
        return shoppingFeedbacks;
    }

}
